package cn.itcast.nems.base.web.controller.b;

import cn.itcast.nems.base.dao.entity.Paymentchannel;
import cn.itcast.nems.oldems.service.PaymentchannelService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 付款渠道
 * <p>
 * 前端控制器
 * </p>
 *
 * @author czq
 * @since 2024-02-28
 */
@Controller
@RequiredArgsConstructor
@RequestMapping("/b/paymentchannel")
public class PaymentchannelController {
    @Autowired
    private PaymentchannelService paymentchannelService;

    @GetMapping
    public ResponseEntity<?> list(@RequestParam(value = "school_id") String schoolId, @RequestParam(value = "name", required = false) String name) {
        return ResponseEntity.ok().body(paymentchannelService.list(schoolId, name));
    }

    @GetMapping(value = "/{id}")
    public ResponseEntity<Paymentchannel> getById(@PathVariable("id") String id) {
        return ResponseEntity.ok().body(paymentchannelService.getById(id));
    }


}
